<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>创建数据 - TPCMS内容管理系统</title>
<link rel="stylesheet" href="./static/install/css/install.css?v=9.0" />
<script type="text/javascript" src="./static/install/js/jquery.js"></script>
</head>
<body>
<div class="wrap">
    {include template('header')}
    <section class="section">
        <div class="step">
            <ul>
                <li class="on"><em>1</em>检测环境</li>
                <li class="on"><em>2</em>创建数据</li>
                <li class="current"><em>3</em>完成安装</li>
            </ul>
        </div>
        <div class="install" id="log">
            <ul id="loginner"></ul>
        </div>
        <div class="bottom tac"> <a href="javascript:;" class="btn_old"><img src="./static/install/images/install/loading.gif" align="absmiddle" />&nbsp;正在安装...</a></div>
    </section>
<script type="text/javascript">
var n=0, step = 'database';
var data = {$data};
$.ajaxSetup ({ cache: false });
function reloads(n, step) {
    data.n = n;
    data.step = step;
    var url =  "{U('Install')}";
    $.ajax({
        type: "POST",		
        url: url,
        data: data,
        dataType: 'json',
        beforeSend:function(){},
        success: function(msg){
            var scrollTop = $("#log")[0].scrollHeight; 
            if (msg.status == 1) {
                $('#dosubmit').attr("disabled",false);
                $('#dosubmit').removeAttr("disabled");              
                $('#dosubmit').removeClass("nonext");
                setTimeout('gonext()',2000);                
            } else {
                if (msg.status == -1) {
                    $('#log').css('color', '#CC3333').html(msg.message);
                    $('a.btn_old').html('安装中止');
                } else {
                    if(msg.step){
                        $('#loginner').append(msg.message);
                        $('#log').scrollTop(scrollTop);                
                        reloads(msg.n, msg.step);
                    } else {
                        alert(msg.message);
                    }                    
                }
            }			 
        }
    });
}
function gonext(){
    window.location.href="{U('step_5')}";
}
$(document).ready(function(){
    reloads(n);
})
</script> 
</div>
{include template('footer')}
</body>
</html>